﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CavinatorService.DAO.Extensao;
using System.Runtime.Serialization;

namespace CavinatorService.Model
{
    /// <summary>
    /// Classe para representar uma resposta
    /// </summary>
    [DataContract]
    public class Answer
    {
        #region Properties

        /// <summary>
        /// Id da resposta
        /// </summary>
        [DataMember]
        public int Id { get; set; }

        /// <summary>
        /// Id do item
        /// </summary>
        [DataMember]
        public int IdItem { get; set; }

        /// <summary>
        /// Id da Pergunta (Para BulkCopy)
        /// </summary>
        [DataMember]
        public int IdQuestion { get; set; }

        /// <summary>
        /// Dados da pergunta
        /// </summary>
        [DataMember]
        public Question Question { get; set; }

        /// <summary>
        /// Resposta
        /// </summary>
        [DataMember]
        public string AnswerValue { get; set; }

        #endregion

        #region Constructors

        public Answer()
        {
            Question = new Question();
        }

        public Answer(IDataReader drlinha)
        {
            Question = new Question();
            Id = drlinha.VerificarColuna("Id", 0);
            IdItem = drlinha.VerificarColuna("IdItem", 0);
            Question.Id = drlinha.VerificarColuna("IdQuestion", 0);
            IdQuestion = Question.Id;
            Question.Value = drlinha.VerificarColuna("Value", string.Empty);
            AnswerValue = drlinha.VerificarColuna("Answer", string.Empty);
        }

        #endregion

        #region Methods
        #endregion
    }
}
